#ifndef FORMMEMBERANDTEAM_H
#define FORMMEMBERANDTEAM_H

#include <QWidget>
#include <QSqlDatabase>
#include <QIcon>
#include <QSqlTableModel>
#include <QSqlRelationalTableModel>
#include <QSqlQueryModel>
#include <QShowEvent>
#include <QTableView>
#include <QCompleter>

#include <../core/cwall.core_global.h>
#include <teammembermodel.h>

namespace Ui {
class FormMemberAndTeam;
}

class FormMemberAndTeam : public QWidget
{
    Q_OBJECT

public:
    explicit FormMemberAndTeam(QSqlDatabase db, QWidget *parent = 0);
    ~FormMemberAndTeam();

public slots:
    void MemberUpdate();
    void TeamUpdate();

private slots:
    void on_actionAdd_member_triggered();
    void on_actionAdd_team_triggered();
    void on_actionDrop_team_triggered();
    void on_actionDrop_member_triggered();
    void on_lineEdit_textChanged(const QString &arg1);
    void on_tableViewMember_clicked(const QModelIndex &index);
    void on_actionMemberUpdate_triggered();
    void on_actionMemberCommit_triggered();
    void on_pushButtonReload_clicked();
    void on_pushButtonReject_clicked();
    void on_pushButtonApply_clicked();
    void on_actionTeamCommit_triggered();
    void on_actionTeamUpdate_triggered();


    void on_toolButtonInsertToTeam_clicked();

    void on_toolButtonDropFromTeam_clicked();

private:
    void showEvent(QShowEvent *);

    Ui::FormMemberAndTeam       *ui;
    QSqlDatabase                dbase;
    QSqlRelationalTableModel    *modelMember;
    //QSqlRelationalTableModel    *modelTeamMember;
    //QSqlTableModel              *modelTeam;
    QSqlTableModel              *modelRange;
    QSqlTableModel              *modelgender;
    QTableView                  *viewRange;
    QTableView                  *viewgender;
    //QTableView                  *viewMemberInTeam;
    teamMemberModel             *modelTeam;

signals:
    void closed();
};

#endif // FORMMEMBERANDTEAM_H
